package com.gt.admin.controller;

import com.gt.common.core.domain.AjaxResult;
import com.gt.admin.domain.apiVO.MonitoringAnalysisResult;
import com.gt.admin.domain.vo.CaseUploadMonitoring;
import com.gt.admin.domain.vo.CountTime;
import com.gt.admin.domain.vo.QuestionnaireFillingMonitoring;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Api(tags = "sc-筛查监控分析")
@RestController
@RequestMapping("/monitoring-analysis")
public class MonitoringAnalysisController {
    /**
     * 获取分析结果
     */
    @ApiOperation(value = "监控分析结果")
    @GetMapping
    public AjaxResult monitorResult(CountTime countTime){
        // 筛查目录id为空时，默认为0
        if (countTime.getSickId() == null){
            countTime.setSickId(0L);
        }
        MonitoringAnalysisResult result = new MonitoringAnalysisResult();
        List<QuestionnaireFillingMonitoring> fillingMonitoringList = new ArrayList<>();
        List<CaseUploadMonitoring> caseUploadMonitoringList = new ArrayList<>();
        fillingMonitoringList.add(QuestionnaireFillingMonitoring.builder()
                .area("遵义市汇川区")
                .fillingNum(446)
                .commitNum(448)
                .avgSaveDays(36.2)
                .registerCaseNum(342)
                .visitNum(559).build());
        fillingMonitoringList.add(QuestionnaireFillingMonitoring.builder()
                .area("遵义县")
                .fillingNum(415)
                .commitNum(415)
                .avgSaveDays(30.5)
                .registerCaseNum(301)
                .visitNum(668).build());
        fillingMonitoringList.add(QuestionnaireFillingMonitoring.builder()
                .area("桐梓县")
                .fillingNum(300)
                .commitNum(300)
                .avgSaveDays(28)
                .registerCaseNum(288)
                .visitNum(670).build());
        caseUploadMonitoringList.add(CaseUploadMonitoring.builder()
                .hospital("遵义附院")
                .checkNum(450)
                .assessHighRiskNum(20)
                .checkCaseNum(410)
                .imageNum(410)
                .structuredCaseNum(162)
                .recheckNum(105).build());
        caseUploadMonitoringList.add(CaseUploadMonitoring.builder()
                .hospital("红花岗中心医院")
                .checkNum(422)
                .assessHighRiskNum(31)
                .checkCaseNum(468)
                .imageNum(468)
                .structuredCaseNum(112)
                .recheckNum(85).build());
        caseUploadMonitoringList.add(CaseUploadMonitoring.builder()
                .hospital("红花岗中心二院")
                .checkNum(377)
                .assessHighRiskNum(15)
                .checkCaseNum(393)
                .imageNum(393)
                .structuredCaseNum(162)
                .recheckNum(105).build());
        result.setQuestionnaireFillingMonitoringList(fillingMonitoringList);
        result.setCaseUploadMonitoringList(caseUploadMonitoringList);
        return AjaxResult.success(result);
    }
}
